<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网关</title>
    <link rel="stylesheet" href="../static/lib/bootstrap/css/bootstrap.min.css">
    <script src="../static/js/jquery.min.js"></script>
    <style>
        .container {
            margin-top: 10px;
            font-size: 16px;
            text-align: center;
        }
        .container span{
            display: inline-block;
            width: 150px;
            text-align: left;
        }
        .container div {
            margin-bottom: 10px;
        }
        #test-amount, #test-amount {
            width: 135px;
            text-align: left;
        }
    </style>
</head>
<body>
    <div class="container">
        <form action="/shop" method="post" onsubmit="return check()">
            <div>
                <span>
                    支付类型：
                </span>
                <select name="testType" id="test-type">
                    <option value="none">请选择</option>
                    <option value="WEIXIN_SCAN">微信扫码</option>
                    <option value="WEIXIN_H5">微信H5</option>
                    <option value="WEIXIN_SYT">微信收银台</option>
                    <option value="ALI_SCAN">支付宝扫码</option>
                    <option value="ALI_H5">支付宝H5</option>
                    <option value="ALI_SYT">支付宝收银台</option>
                    <option value="QQ_SCAN">QQ扫码</option>
                    <option value="QQ_H5">QQ-H5</option>
                    <option value="QQ_SYT">QQ收银台</option>
                    <option value="UNION_SCAN">银联扫码</option>
                    <option value="UNION_H5">银联H5</option>
                    <option value="UNION_WAP">银联wap</option>
                    <option value="UNION_SYT">银联收银台</option>
                    <option value="UNION_FAST">银联快捷</option>
                    <option value="BAIDU_SCAN">百度钱包扫码</option>
                    <option value="BAIDU_H5">百度钱包H5</option>
                    <option value="BAIDU_SYT">百度钱包收银台</option>
                    <option value="JD_SCAN">京东扫码</option>
                    <option value="JD_H5">京东H5</option>
                    <option value="JD_SYT">京东收银台</option>
                </select>
            </div>
            <div>
                <span>
                    支付金额：
                </span>
                <input type="text" placeholder="" value="10" name="testAmount" id="test-amount">
            </div>
            <div>
                <input type="submit" name="submit1" value="提交">
            </div>
        </form>
    </div>
    <script>
        function check() {
            let testType = $("#test-type").val();
            if (testType == "none") {
                alert("请选择支付产品类型");
                return false;
            }
            let testAmount = $("#test-amount").val();
            let  fix_amount = /^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
            if (fix_amount.test(testAmount) == false) {
                alert("请输入正确的金额");
                return false;
            }
            return true;
        }
    </script>
</body>
</html>